# -*- coding: utf-8 -*-
'''
"""
Created on Sat Apr  3 20:11:39 2021

@author: lenovo
"""

import sys

number = input('请输入身份证号：')
lis1 = [int(i) for i in number]
lis2 = [7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2]

if len(number)!=18:
    print('身份证号位数有误')
    sys.exit(0)
    
verify = sum(lis1[i]*lis2[i] for i in range(17))%11

test1 = [i for i in range(11)]
test2 = [1,0,'X',9,8,7,6,5,4,3,2]

month = [i+1 for i in range(12)]
year = [i for i in range(1900,2021)]
day = [i+1 for i in range(31)]

for i in range(len(test1)):
    if i!=2:
        if test1[i] == verify:
            if test2[i]==eval(number[-1]):
                pass
            else:
                print('身份证号错误')
                sys.exit(0)
    else:
        if test1[i] == verify:
            if test2[i]==number[-1]:
                pass
            else:
                print('身份证号错误')
                sys.exit(0)

f = open('shenfen.txt','r',encoding = 'utf-8')
txt = f.readline()

#print(int(number[6:10]) in year)

flag = 1
for txt in f:
    info = txt.split()
    #print(info)
    if info[0] == number[:6]:
        if int(number[6:10]) in year:
            if int(number[10:12]) in month:
                if int(number[12:14]) in day:
                    print('\n地区:{}'.format(info[1]))
                    print('生日：{}年{}月{}日'.format(number[6:10],number[10:12],number[12:14]))
                    
                    if int(number[-2])%2!=0:
                        print('性别：男')
                    else:
                        print('性别：女')
                    flag = 0
                else:
                    print('身份证号错误')

if flag:
    print('未查询到结果')

f.close()
'''
b = input()

    